\name{autoGVEC}
\alias{autoGVEC}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Automatic identification and estimation of Generalized VEC models}
\description{
This function identifies the VAR and performs one of the two versions of the identification algorithm described in Arbues, Ledo (2013).
}
\usage{
autoGVEC(x, var.order = "BIC", pvarmax = 2 * frequency(y), vec.order = "AIC", pvecmax = 2 * frequency(y), logtrans = T, eps1 = log(nrow(x))/sqrt(nrow(x)), eps2 = log(nrow(x))/sqrt(nrow(x)), d = "BIC", method = 0)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{x}{
A multivariate series whose model we want to identify.
}
  \item{var.order}{
Order of the VAR model fitted. If var.order="AIC" or var.order="BIC", the order is identified by an information criterion.
}
  \item{pvarmax}{
Maximum order of the VAR. Used only if var.order="AIC" or var.order="BIC".
}
  \item{vec.order}{
Order of the GVEC model fitted. If vec.order="AIC" or vec.order="BIC", the order is identified by an information criterion.
}
  \item{pvecmax}{
Maximum order of the GVEC. Used only if vec.order="AIC" or vec.order="BIC".
}
  \item{logtrans}{
If TRUE, log transform applied.}
  \item{eps1}{
Margin or tolerance for the approximate Smith algorithm. 
}
  \item{eps2}{
Margin or tolerance to separate unit roots (usually, equal to \code{eps1}).
}
  \item{d}{
Deterministic effects. It may be a list with a subset among "i" (intercept), "t" (trend) or equal to "AIC" or "BIC" to use information criteria instead.
}
\item{method}{
if equal to 0, first version of the algorithm, otherwise, second version is applied.
}
}
\details{
The algorithm are explained in the article. The only departures are: (i) we allow to use different coefficients for the approximate Smith algorithm and to separate the unit roots (ii) intercept and deterministic linear trends can be included in the model.}
\value{
A list with the following: 
\item{deltas}{is a list with the distinct polynomials of the Smith form.}
\item{pvec}{finally chosen order of the GVEC.}
\item{estcoef}{estimated coefficients of the GVEC.}
\item{pvar}{finally chosen order of the VAR.}
\item{D}{Smith form.}
\item{sigma}{covariance matrix of the GVEC.}
\item{determ}{deterministic terms of the GVEC.}
\item{list.Delta}{difference operators of the GVEC. These are the Delta_jkl operators in proposition 3.}
}
\references{
Arbues, Ledo (2013).}
\author{
Ignacio Arbues.
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{

n<-200
xmat<-apply(matrix(rnorm(2*n),nrow=n),2,cumsum)
x<-ts(data=xmat,frequency=4,start=c(1,1))
model<-autoGVEC(x,var.order='BIC',vec.order='BIC',logtrans=F,d='BIC',eps1=log(log(n))/sqrt(n),eps2=log(log(n))/sqrt(n),method=1)
pred<-GVECpred(x,4,model,64)

}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
